package ua.lviv.franko.mlsFunctions.oneDimension;

import java.util.ArrayList;

import ua.lviv.franko.FEMShapeFunction1D.IFEM1D;
import ua.lviv.franko.integration.IFunction1D;
import ua.lviv.franko.mlsFunctions.oneDimension.weightFunctions.IWeightFunction;

public class ModifiedFEMBaseFunction extends BaseFunctionCoupled implements IFunction1D {
	public IFEM1D	modifiedFEM;

	public ModifiedFEMBaseFunction(int PolinomialDegree, Particle xi, IWeightFunction func, ArrayList<IFEM1D> femList, IFEM1D f) {
		super(PolinomialDegree, xi, func, femList);
		this.modifiedFEM = f;
	}

	@Override
	public double calculate(double x) {
		return super.calculate(x) + modifiedFEM.calculate(x);
	}

	@Override
	public double[] calculateAll(double x) {

		double[] res = super.calculateAll(x);
		res[0] += modifiedFEM.calculate(x);
		res[1] += modifiedFEM.calculateDerivaty(x);
		return res;
	}

	@Override
	public double calculateDerivaty(double x) {
		return super.calculateDerivaty(x) + modifiedFEM.calculateDerivaty(x);
	}

}
